/**
 * @author harry
 * @date 2022/2/23/20:38
 */

package com.serviceOrchestration.atomic;

import java.util.HashMap;
import java.util.Map;

/**
 * 用于保存原子服务的上下文
 */
public class AtomicUnitContext {
    private String error;
    private final Map<String, Object> context = new HashMap<>();
    private final Map<String, Object> returnData = new HashMap<>();

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public void addContext(String key, Object value) {
        context.put(key, value);
    }

    public Object getContext(String key) {
        return context.getOrDefault(key, null);
    }

    public void addReturnData(String key, Object value) {
        returnData.put(key, value);
    }

    public Map<String, Object> getReturnData() {
        return returnData;
    }
}
